import React from "react";
import { Route, NavLink, Switch } from "react-router-dom";

import Header from "./components/Header";
import Home from "./pages/Home/index";
import About from "./pages/About";

function App() {
  return (
    <div className="app">
      <Header a="1" b="2" />
      <div className="main">
        <div className="left">
          <NavLink className="link" to="/home" activeClassName="hello">
            Home
          </NavLink>
          <NavLink className="link" to="/about" activeClassName="hello">
            About
          </NavLink>
        </div>
        <div className="right">
          {/* 
            Route 有一个 exact 的属性，如果设置这个属性的话，就表示开启精准匹配
            /home/a/b/c  => /home   能匹配是因为默认为 模糊匹配

            注意：如果这个路由下有子路由的话，exact 会导致问题
          */}
          <Switch>
            <Route path="/home" component={Home} />
            <Route path="/about" component={About} />
          </Switch>
        </div>
      </div>
    </div>
  );
}

export default App;
